dsutuyxe088689 2013-06-11 15:08
浏览 30
已采纳

如何通知网站安装了应用程序?

When user enter my site they receive a dialogue box proposing to install my wonderful app. When the user presses the accept button, the play market page with my app pops up. This dialog box appears only if user browses from phone. However, this dialog will popup even if user has my app already. Thus, I am interested in a way to inform site about presence/absence of an app on the phone. If app already installed on a phone, dialog should not appear.

phone w/o app -> browse site -> get dialoge box
phone with app -> browse site -> normal browsing

Simple and useless solution which comes in mind: If link is opened from my app, it is extended with some action to identify that app is installed.
It is useless, because app is all-sufficient, so opening site will not give any benefit.

A bit more advanced idea was proposed by msh: Give user an option which app will open a link. If link is opened with my app as above.

Is there a better way to do this ?

  • 写回答

3条回答 默认 最新

  • dongshadu4498 2013-08-06 07:17
    关注

    Yes, Mobile Browsers (on their own) cannot communicate the application installed status to web. But still if you are desperate to implement this behavior, I have got a "WILD" solution for you.

    This Solution is divided in two parts: Client Side (Android Device) / Server Side (Web)

    Client Side (on Android Device):

    In your application you'll need to implement a BroadcastReciever that will be continuously listening to the Network State changes. Whenever a broadcast is received for new network connection available (e.g. when the user turns on the Mobile Data), your app should read the acquired IP address and communicate it to your web-server (using HttpURLConnection).

    Communicating the IP address will inform your web-server that the device browsing your website from this IP address has got your application installed.

    Server Side (on Web Server):

    Your web-server will keep a track of all the IP addresses reported by all the devices on which your application is installed(off-course in a database). To avoid redundant entries you can decide a expiry/validation time for each IP address record received.

    Now when your server receives a web request, it will match the IP of the requesting client with all the IP's that were saved in its database. If it finds a matching IP, it means that the web request has come from a device on which your application is already installed. Otherwise you can direct the user to your app's play store link.

    Limitation of proposed Solution: This solution will work with 100% accuracy only in the case when the user is using Mobile Data (2g / 3g / etc) to connect to internet. Since using Mobile Data, everytime the device will be issued a unique IP address by the service provider.

    This wont work perfectly for wi-fi connections. While browsing using a wi-fi, all the devices that are connected to same wi-fi spot are allocated the same IP address. So there may be a situation where two mobile phones are using internet from same wi-fi spot, out of which one phone has your application installed and the other phone does not. This will confuse the server.

    ** This solution may not be highly recommended, but could be used with some minor fixes if you don't get any other solutions ;)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥30 关于#微信#的问题:微信实名不绑卡 可以实现吗 有没有专家 可以解决
  • ¥15 (标签-考研|关键词-set)
  • ¥15 求修改代码,图书管理系统
  • ¥15 请问有没求偏多标签数据集yeast,reference,recreation,scene,health数据集。
  • ¥15 传感网应用开发单片机实训
  • ¥15 Delphi 关于sAlphaImageList使用问题
  • ¥15 寻找将CAJ格式文档转txt文本的方案
  • ¥15 shein测试开发会问些啥我是写java的
  • ¥15 关于#单片机#的问题:我有个课程项目设计,我想在STM32F103veTX单片机,M3主控模块上设计一个程序,在Keil uVision5(C语言)上代码该怎么编译?(嫌钱少我可以加钱,急急急)
  • ¥15 opnet仿真网络协议遇到问题