Wednesday, 29 July 2015

my reachability issue of my android app

I have a post before about how to checkout reachability:

In my project I use a service to run that code to exam and board cast the result and a receiver responses that and change UI (show a red message on top of the screen).

The problem I got is that the red message flickers all the time.

Finally I found that, For my app, I generated multi apks for dev, staging and prod. they all have different app ID, so I can install all of them into one android device.

dev staging and prod they all link to different API endpoint, so their reachability checking url are different.

Because I haven't set prod's API endpoint, it always failed.  And because they all board cast reachability status to a same ACTION string.

Therefore, My app will always flicker because prod board cast "false" result and dev board case "true" result.

My solution is making them broadcast status to different ACTION strings.

And that also benefit other apps if they want to use my code (I may turn it to a lib), they won't affect each other.

No comments:

Post a comment