This is a migrated thread and some comments may be shown as answers.

checking and Installing new update if internet connection available

1 Answer 54 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ashfaq
Top achievements
Rank 1
Ashfaq asked on 14 Feb 2015, 10:04 AM
Dear friends,
I have an application to display some details in the main activity all i want to do is check for update in play store and if there is update application automatically.Please help me to do so since im new in android.


Mainactivity.java
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

public class Ongoing extends Fragment {
// flag for Internet connection status
    Boolean isInternetPresent = false;
    // Connection detector class
     
    ConnectionDetector cd;
public Ongoing(){}

@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
getActivity().setTitle("Ongoing Projects");
        View rootView = inflater.inflate(R.layout.ongoing_frag, container, false);
       
       
        cd = new ConnectionDetector(getActivity()); 
        isInternetPresent = cd.isConnectingToInternet();
        
        if (isInternetPresent) {
            // Internet Connection is Present
            // make HTTP requests
        Toast.makeText(getActivity(), "You have Internet", Toast.LENGTH_SHORT).show();
       
                            
               
       
            
        } else {
            // Internet connection is not present
            // Ask user to connect to Internet
        Toast.makeText(getActivity(), "You dont Internet", Toast.LENGTH_SHORT).show();
        }
        
               
        return rootView;
    
        
}

}

1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 18 Feb 2015, 04:29 PM
Hello Ashfaq,

If you are building a hybrid app, then you will need a plugin for this task. If this code is from a custom plugin you are building, I would suggest posting your query on the Android developer forums.

If you are looking for a general approach to updating your hybrid application from within Google Play, then you can define a service that regularly checks for updates of your app and when a new update is detected, prompts the user to install it. You can use the Market Cordova plugin to open Google Play or AppStore from within your application.

Regards,
Tina Stancheva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Ashfaq
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or