Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How pass params to my app when installed from local files or from Google Play?

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?

like image 446
Adrian Cid Almaguer Avatar asked Feb 17 '15 06:02

Adrian Cid Almaguer


2 Answers

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

like image 125
mes Avatar answered Nov 12 '22 06:11

mes


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.

like image 25
Christian Avatar answered Nov 12 '22 07:11

Christian