12

I am making an app that shows a personalized greeting message to users.

For Example: If I send my app by bluetooth (or I send the app by email to be installed) to X person to congratulate him on the day of his birthday, once the person installed the app a message should appear saying "Congratulations X".

Edit: I found a solution when the app is installed from Google Play in Pass param to app when installed from Google Play

But if the scenario is different, because not all the persons who will receive the app can access Google Play.

@mes posted an answer where he suggested to use AccountManager. But what happens if there is no registered account in the device or the device not have internet connection?

By example, if I send the app to X (X installs the app and will see his congratulation message "Congratulations X") and X wants to congratulate his friend Y (with the message "Congratulations Y") X copies the app to the SD of his friend's device and expects that when Y installs the app, Y can see the message "Congratulation Y".

It is the same app but I need to pass the name of the person who is going to be congratulated while the application is being installed, with this each person could have his congratulation message with his name once the app is open.

Is there a way to achieve this?

Community
  • 1
  • 1
Adrian Cid Almaguer
  • 7,815
  • 13
  • 41
  • 63

2 Answers2

8

I can suggest another solution for greeting message, you can get registered accounts of the user, and then use one of their names, for example Google account's name or Facebook account's name. Check this link, this can be helpful AccountManager

mes
  • 3,581
  • 29
  • 28
  • I need to show the message immediately the application runs – Adrian Cid Almaguer Feb 17 '15 at 12:03
  • 1
    In this case, it can show immediately, because that information stored inside the device, no network activity is needed – mes Feb 17 '15 at 12:29
  • Yes, but if the user don't have accounts registered there is not name to show. – Adrian Cid Almaguer Feb 17 '15 at 13:13
  • 1
    Of course, in that case, if user don't have accounts registered, only solution is to make a special build for him, with hard coded greeting message :) – mes Feb 17 '15 at 13:24
  • yes, but if you can send the app to yours friend I need make 1 app for each one of them if they don't have accounts. – Adrian Cid Almaguer Feb 17 '15 at 13:31
  • you can write a script, that will automate that process, you can pass a file, where are a list of friends, then it will make a change in the constants file, and then will invoke a command line tool, for example a gradle, it is a another solution, if you plan to make a lot of builds – mes Feb 17 '15 at 13:41
  • but what happens if you have the app with your name inside and you want send it to another person? – Adrian Cid Almaguer Feb 17 '15 at 13:43
  • I will show the greeting, that hard coded into it. Without any accounts stored in the phone, ant without any service, there's no way to know user's name – mes Feb 17 '15 at 13:48
  • I cant' take the name from the app's name? something like com.app.hello-Mike.apk ? Taking the name of Mike – Adrian Cid Almaguer Feb 17 '15 at 13:51
  • do you have any idea of why somebody vote down my question? You consider that I can edit something? – Adrian Cid Almaguer Feb 17 '15 at 17:03
  • I have no idea why voted down, I read this link, but it seems that this is not a bad question http://stackoverflow.com/help/how-to-ask – mes Feb 18 '15 at 07:14
2

I think you have figured it out when installing from google play, so let's focus in the problem when you send your apk by email and the user doesn't have an account in the device and he doesn't have internet connection also.

So, I suspect you expect the users have to put your .apk into a sdcard and then open it through some file manager, right?

In that case, why don't you send an extra file (like user.info) and instruct the user to save both files (.apk and .info) into sdcard and then when you open your app for the first time, you look for the user.info file in sdcard and read it's contents to know user's name and stuff?

Even better... you could zip both files into a single zip file and instruct them to "extract the zip content to your sdcard and blah, blah. blah.."

That way, you'll have one single app compilation and all custom info you're gonna need is located in the user.info file.

You could attach the .info file into .apk file, but this is pretty much more complex. But if you're interested in such kind of solution, read more here.

Community
  • 1
  • 1
Christian
  • 7,062
  • 9
  • 53
  • 79