반응형

어플 상태 확인 후 접속 불가능한 상태면 


안내창 작업 예정


<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />


3
4
5
6
7
private boolean checkNetwordState() {
    ConnectivityManager connManager = cManager=(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo state_3g = connManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
    NetworkInfo state_wifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
 
    return state_3g.isConnected() || state_wifi.isConnected();
}


함수 호출 후 true 가 아니면 


토스트로 안내..


1. 일단 기본 프로젝트 하나 만드세요.
2. 메니페스트에 밑에 걸 등록하세요.
manifest에
 
        <receiver android:name=".ConnReceiver" android:enabled="true" android:priority="0">
            <intent-filter>
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
            </intent-filter>
     </receiver>
이걸 추가하시구요.
3. ConnReceiver.java파일 하나 만드시구요. 이걸 입력하세요.
public class ConnReceiver extends BroadcastReceiver{
 public void onReceive(Context context, Intent intent) {
  String action = intent.getAction();
  if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
   NetworkInfo info = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
   NetworkInfo.DetailedState state = info.getDetailedState();
   if (state == NetworkInfo.DetailedState.CONNECTED) {
    Toast.makeText(context, "연결되었습니다.", Toast.LENGTH_LONG).show();
   } else if (state == NetworkInfo.DetailedState.DISCONNECTED) {
    Toast.makeText(context, "연결이 끊어졌습니다.", Toast.LENGTH_LONG).show();
   }
  }
 }
}
 


참고url

http://jjorae.com/posts/866



반응형
반응형

http://jsfiddle.net/niceaji/zFhQB/


허허 좋타



http://kimstar.pe.kr/blog/74

반응형
반응형


<a href="#" onclick="excelDown('파일명')" ; return false;">


<script type="text/javascript">

$( document ).ready( function(){

function excelDown(file){

alert('다운로드 시작');

location.href="pool_bond_download.jsp?file="+file;

}

});

</script>

요건 오류가 났다 함수를 못찾음;;


<script type="text/javascript">

function excelDown(file){

alert('다운로드 시작');

location.href="pool_bond_download.jsp?file="+file;

}

</script>


요건 정상 실행 뭐지?? 


검색해보니..


http://stackoverflow.com/questions/1055767/why-can-i-not-define-functions-in-jquerys-document-ready


함수명 = functin() {}  요러케 

혹은

function 함수명() {}

함수명();


요렇게 써야 한다고 함 ~


그래서 수정했더니 잘됨 아주 잘됨 ~


$( document ).ready( function(){

excelDown =function (file){

alert('다운로드 시작');

location.href="pool_bond_download.jsp?file="+file;

}

});


크크




반응형
반응형

이미지 만들거나 ~ 다운로드


res > drawble 각 폴더에 이미지 삽입



해당 layout .xml 찾아가서

imageview > src  로 방금 삽입한 이미지 선택





이미지가 짤리거나 뒷 배경과 안어울리면


vlaues > string.xml 파일에 변수 추가


<color  name="splashcolor">#41828D</color>


그리고 Backgroud 에서 해당 변수 선택 




끝읏~~



반응형
반응형



첫번째


플젝

Clean 


GEN > 안에 생긴 패키지폴더 삭제

빌드 ~


두번째

AndroidManifest.xml 


패키지명 현재 패키지와 맞나 비교



패키지명에 오타가 있었음 ;;;;;










반응형
반응형




Splash.class 작성


import android.app.Activity;

import android.os.Bundle;

import android.os.Handler;


public class Splash extends Activity{

@Override

protected void onCreate(Bundle savedInstanceState) {

// TODO Auto-generated method stub

super.onCreate(savedInstanceState);

setContentView(R.layout.splash);

         

       Handler hd = new Handler();

       hd.postDelayed(new Runnable() {

 

           @Override

           public void run() {

               finish();       // 3 초후 이미지를 닫아버림

           }

       }, 3000);

}


}


MainActivity.class


 setContentView(R.layout.main); 

// 위 소스 아래부분에  splash.class 호출

 startActivity(new Intent(this,Splash.class));


3초가 로딩 후 메인화면 뿌려짐

AndroidManifest.xml


기존 activity 태그 위에 아래 태그 삽입

<activity android:name=".Splash" android:theme="@android:style/Theme.NoTitleBar" />  


res > layout 폴더 아래

splash.xml 추가


<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="match_parent"

    android:layout_height="match_parent" 

    android:background="@drawable/ic_launcher">

 </RelativeLayout>


끝~~ 



반응형
반응형

소스 수정 

    @Override

    protected void onMessage(Context context, Intent intent) {

        Log.i(TAG, "Received message");  

        Log.i(TAG, "Received message context " +  intent.getExtras().getString("message"));

        //String message = getString(R.string.gcm_message);

        Vibrator vibrator = (Vibrator)getSystemService(context.VIBRATOR_SERVICE);

        vibrator.vibrate(1000);

        

        WakeUpScreen.acquire(getApplicationContext(), 10000); 

        

        String message = intent.getExtras().getString("message");

        // notifies user

        generateNotification(context, message);

       

    }


WakeUpScreen  CLASS 추가



import android.content.Context;

import android.os.PowerManager;


/**

 * 스크린을 ON한다. 젤리빈 4.2부터는 getWindows() 권장

 * @author IKCHOI

 *

 */

public class WakeUpScreen {

 

    private static PowerManager.WakeLock wakeLock;

 

    /**

     * timeout을 설정하면, 자동으로 릴리즈됨

     * @param context

     * @param timeout

     */

    public static void acquire(Context context, long timeout) {

 

        PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);

        wakeLock = pm.newWakeLock(

                PowerManager.ACQUIRE_CAUSES_WAKEUP  |

                PowerManager.FULL_WAKE_LOCK         |

                PowerManager.ON_AFTER_RELEASE

                , context.getClass().getName());

 

        if(timeout > 0)

            wakeLock.acquire(timeout);

        else

            wakeLock.acquire();

 

    }

 

    /**

     * 이 메소드를 사용하면, 반드시 release를 해줘야 함

     * @param context

     */

    public static void acquire(Context context) {

        acquire(context, 0);

    }

 

    public static void release() {

        if (wakeLock.isHeld())

            wakeLock.release();

    }

}


Manifest 추가
    <uses-permission android:name="android.permission.VIBRATE"/>
    <!-- Keeps the processor from sleeping when a message is received. -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />


참고    http://nonstop.pe.kr/android/1612

참고 2  http://www.androidside.com/bbs/board.php?bo_table=b49&wr_id=107992

반응형
반응형

기존 GCM 테스트 앱에서  


기본 설정 퍼미션(권한) 부분 가져오 Manifest


<!-- GCM requires Android SDK version 2.2 (API level 8) or above. -->

    <!-- The targetSdkVersion is optional, but it's always a good practice

         to target higher versions. -->

    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19"/>


    <!-- GCM connects to Google Services. -->

    <uses-permission android:name="android.permission.INTERNET" />


    <!-- GCM requires a Google account. -->

    <uses-permission android:name="android.permission.GET_ACCOUNTS" />


    <!-- Keeps the processor from sleeping when a message is received. -->

    <uses-permission android:name="android.permission.WAKE_LOCK" />


    <!--

     Creates a custom permission so only this app can receive its messages.


     NOTE: the permission *must* be called PACKAGE.permission.C2D_MESSAGE,

           where PACKAGE is the application's package name.

    -->

    <permission

        android:name="com.google.android.gcm.demo.app.permission.C2D_MESSAGE"

        android:protectionLevel="signature" />

    <uses-permission

        android:name="com.google.android.gcm.demo.app.permission.C2D_MESSAGE" />


    <!-- This app has permission to register and receive data message. -->

    <uses-permission

        android:name="com.google.android.c2dm.permission.RECEIVE" />



어플 설정에 recever 

<!--

          BroadcastReceiver that will receive intents from GCM

          services and handle them to the custom IntentService.


          The com.google.android.c2dm.permission.SEND permission is necessary

          so only GCM services can send data messages for the app.

        -->

        <receiver

            android:name="com.google.android.gcm.GCMBroadcastReceiver"

            android:permission="com.google.android.c2dm.permission.SEND" >

            <intent-filter>

                <!-- Receives the actual messages. -->

                <action android:name="com.google.android.c2dm.intent.RECEIVE" />

                <!-- Receives the registration id. -->

                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

                <category android:name="com.google.android.gcm.demo.app" />

            </intent-filter>

        </receiver>


        <!--

          Application-specific subclass of GCMBaseIntentService that will

          handle received messages.


          By default, it must be named .GCMIntentService, unless the

          application uses a custom BroadcastReceiver that redefines its name.

        -->

        <service android:name=".GCMIntentService" />




반응형
반응형


How to install Android SDK in SpringSource Tool Suite on Linux Mint and Ubuntu


1.       Install Android SDK
a.       Download Android SDK
b.      Extract the file into any folder. I usually install applications into /opt when I don’t use a package manager.
c.       Run [/opt/android-sdk-linux/tools/android]


e.      Select APIs and Click [Install Packages…]
2.       Setup Eclipse
a.       Run Eclipse. I use SpringSource Tool Suite.
b.      Click [Help > Install New Software…]
c.       Input (https://dl-ssl.google.com/android/eclipse/) in an edit box labeled [Work with:]
d.      Click [Add…]
e.      Input (ADT plugin) in an edit box labeled [Name] and Click [OK]
f.        Click [Select All] and [Developer Tools] and [NDK Plugins] may be selected.
g.       Click [Next >]



요렇게 추가해 주면 끝



출처 ) http://juliendkim.blogspot.kr/2012/07/how-to-install-android-sdk-in.html



반응형
반응형

baas  이용해서 푸쉬 날려볼려고 테스트 프로젝트 만들고 있었다~~~


계속 푸쉬가 안날라가서... 

푸쉬가 동작을 안하였다... 에꿋은 소스만 수정 ~ 삽질 ~ 수정


개편이 되었는지... 구글링을 해도 안나온다..


프로젝트ID를 넣어라고 해서 

아무생각없이 

Project ID: xx --> 여기 영문으로 되어있는걸 복사했다
혹시 하고  프로젝트 아이디 말고   Project Number: 111 -> 숫자

복사해서 테스트 했더니 성공했다..

아오 삽질

   // GCM(google cloud messaging service) sender ID
    public static final String GCM_SENDER_ID = "숫자";

요약
Project ID: b 말고
 
Project Number: 111  복사해서 넣차



반응형

+ Recent posts