PanicInitiative / PanicButton

Panic Button turns your mobile phone into a secret alarm for when you're in trouble
https://panicbutton.io
GNU General Public License v3.0
200 stars 99 forks source link

Add a notification on 1.5 update #143

Open jmatsushita opened 8 years ago

jmatsushita commented 8 years ago

Popup a system notification on update to alert that "Calculate! has been updated."

Clicking would take the user to the Calculator, where there might be a decoy message or not (maybe the color bar should be a different color?) Then once the user goes past the disguise they would be taken to a short training session that explains the change and the advanced settings.

niccs commented 8 years ago

@jmatsushita , for this one also

I think we don't need to do anything specific. With play store, the update notification is taken care of by Google Play. Once we upload the new APK with higher version code,Google Play should do the notification part for existing users.

The other part is, short training-- a) we can mention the new changes in release notes or b) we need to implement this in new APK flow.
We can make sure that post successful installation, this is played only once. But everytime the user installs this latest apk version, training will be played.

Please let me know your views and the training pages we need to follow after disguise screen,

jimmylogan commented 8 years ago

Hi @niccs I think that it makes more sense for the training to be along the lines of (b). This is a major change and I don't think that everyone will read the release notes. It would be good to do try and ensure that, when people install the new version, they know about and practice the new default. Thanks!

jmatsushita commented 8 years ago

There are several concerns here so let me try to help clarify.

1/ The default playstore update mechanism isn't enough to properly attract the attention of our users that there are new ways to trigger. It is just text, update of several apps at the same time just displays in the same notification, it might seem a bit technical to users, and even if part of them read it, we'd like to make sure that it is much much more difficult to ignore. In order to do this, the approach I think so far would be most efficient is to use a system notification that sits on the top tray and on the lock screen and says "Calculate! has been updated!". I don't think it's possible to prevent this to go away until the user has clicked (I think it's only possible with system notifications) but if it was possible I'd like to go this route.

2/ Once the user is notified as per 1/ we need to take them to an explanation of the changes and allow them to test these changes (in the way we did when the user first installed the app). We can allow them to skip the training (with an appropriate warning screen "The panic button activation trigger has changed and we recommend you to test these changes until you are familiar with them. Are you sure you want to skip this training?". I think it's a good idea to also propose this training (after the unlocking of the disguise) even if the user didn't click on the notification (and remove the notification if they've done the training or skipped it).

By decoy message I mean that in accordance to our philosophy with the disguise, we want to avoid raising attention of potential other users of the phone, or people that would casually look at it when our user is following the notification link and maybe doesn't remember what Calculate! is. So my proposal to preserve the disguise's integrity even during this notification and training sequence is to do as follow:

@jimmylogan feel free to improve on the editorial here of course.

niccs commented 8 years ago

@jmatsushita ,

I have gone through the notification apis, to implement or modify the playstore kind of System notifiation (the app update notification) is not possible/allowed from given android APIs.

Still to implement this, there are following ways:-

1) we need to parse the google play page where we publish the apk, to check whether the version number is increased. But again, google play is a closed system with no official API, and we can not rely on that undocumented API(can change in future without notification).

2)Another suggested option is to keep the information on the webserver by updating the version code in a xml file there.Then implement a webservice from the code to check the version code and trigger the app notification process.

So its like a whole new dimension to implement this(given the current release is next week). Kindly share your views on the same.

niccs commented 8 years ago

Hi @jmatsushita , Following parts are covered and checked in #143 branch :--

1) The version no in mobile_en.json is changed to 10 to make it specific to 1.5 release. 2) If the app is fresh install, no training is played, and if the app is updated from playstore (1.5 release specific), the training part is taken care of as:--

a)Goes to calculator, shows a Toast that says "Calculate! has been updated. Go to the settings to find out more!". b)Once disguise unlocked, the training flow is started. User can learn or skip it. c) If the training is skipped, next time it will not be played again. d) Also,other languages data will be parsed , once the specific language is selected from menu.

These are the major things , taken care of. Please give your inputs for the same

jmatsushita commented 8 years ago

Hi @niccs would you mind giving me some instructions on how to test this new feature? When I try to Run App... in Android Studio with the App already installed I get an error message. Would be good to know how you're testing this in your development environment so that I can do the same.

niccs commented 8 years ago

@jmatsushita, since the icon changes after install. the app wont allow to update-install in dev environment. So for testing, I have hardcoded a fresh_install flag to false:

In AppUtil.java, newly added method--playTrainingForRelease1_5, un-comment the first line --setFirstRun(context,false);-- I am hardcoding the flag to false here, which says the app is not a fresh install and hence update flow will run.

jmatsushita commented 8 years ago

Hi @niccs Thanks for this. I've released this to the Alpha group on the Play Store but I didn't get this notification. I've added you to the group with your panicbutton email address if you want to test.

niccs commented 8 years ago

Hello @jmatsushita ,

The changes were not merged in dev as testing was pending. I have merged this in dev. So notification should work now.

jmatsushita commented 8 years ago

Hi @niccs thanks for that, great progress. Can you also let us know how things are progressing on adding an android notification? (http://developer.android.com/guide/topics/ui/notifiers/notifications.html)

jmatsushita commented 8 years ago

Also (sorry if this is a duplicate, I can't seem to find it), when redoing the training after the notification toast, it is not needed to do the Disguise training sequence only the hardware alarm training sequence.

jmatsushita commented 8 years ago

Also please keep the toast on the screen indefinitely.

niccs commented 8 years ago

Hi @jmatsushita,

I have given the detailed analysis above (the 5th message from top), currently its not possible to implement or modify the playstore kind of System notification (the app update notification) from given android APIs.

For existing users, only playstore can notify about "the app has been updated".

We can however give notification, once we are inside the app, once the app is updated from playstore and launched. Please let me know, i can work on this then.

jmatsushita commented 8 years ago

Ok thanks for pointing me to that proposal, I think I didn't understand it the first time I read it, but now I do. How about this.

In the future if we want to develop a new notification we can create a new variable to display a different training sequence.

Let me know what you think about this proposal.

niccs commented 8 years ago

@jmatsushita , I got your point. So ideally the stepas would be:

1) playstore will send a normal notification ,saying calculate has been updated.User goes to playstore and updates it. 2) As soon as the update is installed, and app is started, a new notification will come on top tray(app specific). 3) When user clicks it, he is routed to calculator screen and update flow starts.

The only point is, the app specific notification is displayed once the app icon is clicked(app is started). We cant use Boot receiver(its is triggered when the phone is restarted). I will just have a look on other system broadcast recievers, which we can use to trigger the notification.

niccs commented 8 years ago

Hi @jmatsushita,

To run the update flow from android studio following is the way:--

1)In androidmanifest.xml--> comment out the the android-alias section(line no 31 to 43) 2) Uncomment line no 23-- to make the PB homeactivity as launcher 3) In WizardActivity.java--> comment out line no 108(call to changeAppIconToCalculator() method) 4) Similar change in MainActivity.java--> comment out line no 70(call to changeAppIconToPB() method) 5) in mobile_en.json-- make the version number 9-- this is for fresh install.

After these changes, do a fresh install.

And then change the mobile_en.json version to 10(this corresponds to release 1.5) and again install it-- the update flow should run.

Now I will work on notification part.

niccs commented 8 years ago

Hi @jmatsushita ,

the notification part is done. After the update, th user will get a notification and as stated by you, on its click its flow will go on. Please review this.

1) We need a small icon to show on notification message. And as per standards, its size should be 32dp*32dp size. 2) we need one more notification icon for the fix we did for "disabling power button trigger" in advanced settings.