Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,732,550 Members 51,223 Now Online
XDA Developers Android and Mobile Development Forum

How to configure android application before or during instalaltion?

Tip us?
 
VladUkraine
Old
#1  
Junior Member - OP
Thanks Meter 0
Posts: 2
Join Date: May 2014
Default How to configure android application before or during instalaltion?

How to configure android application before or during instalaltion?


Is there any standard approach how to configure android application with custom settings before or during instalaltion?

Our users will not use Android market to install our application. They will download apk file from some local site in local network.

Our android application should communicate with server side application.
Different clients(corporate clients) will use different URLs for server side applications.

We need to setup correct URL for server side application before or during installation of apk file on user's phone/tablet.
It should be done automatically without interaction with user.
User should install apk file and after installation application should work with correct server side application.
How to do it?

One approach - create different apk files for different clients and set somewhere in application resources correct URL for server side application.
I do not like it. Actually client could change location of server side. In this case we will need to create new apk files.

Second approach:
- Create apk file.
- Install/store apk file as part of web application deployed on client's server.
- During installation of web application unpack apk file and put correct URL into some resource file.
- Pack apk again.
- Sign apk file.
- Call zipalign for this file. Is this step optional or required?
- Now user can open this web application in browser, download configured apk file and install it on phone/tablet
As result we will have custom apk file with correct URL for server side application inside.
User will install such apk on phone/tablet and application will connect to correct server side without any interaction with user.
Is the second approach correct?
Is it allowed to re-pack apk files at all?
 
mikereidis
Old
#2  
Recognized Developer
Thanks Meter 3055
Posts: 6,067
Join Date: Jan 2011
Location: Ottawa/Gatineau, Canada
Repackaging APK is WAY too fragile IMO.

Best to find another way.

EG, app starts, and sends request to public Internet server.

Public Internet server checks originating IP address and responds with special URL.


Or,... something on phone, like IP, MAC address, phone number, country etc. is used to calculate a URL or retrieve a URL from a list.


All that said, APK is a ZIP file and I think you could put some files in that won't require a resign.
================================================== =======
__________________________________________________
AudioTricks / VolumeTricks v1.0: A HAL Shim based audio volume/gain mod: http://forum.xda-developers.com/show...php?p=52765309

Spirit2 NextGen: Real FM Radio 4 AOSP: https://play.google.com/store/apps/details?id=fm.a2d.s2
Spirit2 XDA: http://forum.xda-developers.com/show....php?t=2537861


Spirit1 Classic: Real FM Radio 4 AOSP: https://play.google.com/store/apps/d...cros.fm_unlock
Spirit1 XDA: http://forum.xda-developers.com/show...php?p=13379669
 
VladUkraine
Old
#3  
Junior Member - OP
Thanks Meter 0
Posts: 2
Join Date: May 2014
Quote:
Originally Posted by mikereidis View Post
Repackaging APK is WAY too fragile IMO.
Best to find another way.
EG, app starts, and sends request to public Internet server.
Public Internet server checks originating IP address and responds with special URL.
We can't use public internet server.
Our users work in corporate local network. Access to internet could be disabled.
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes