仅显示我的Android应用程序的SignUp Activity一次

时间:2017-11-05 17:36:05

标签: android firebase firebase-authentication

我想知道如何使用Firebase跳过Android应用的注册活动,我想只在第一次运行应用时显示它。 每当用户第二次打开应用程序时,我只需要注册活动,他需要登录并应该重定向到我的其他活动。

我的注册活动是

async function read(dir) {
  let paths, content;

  // read directory of paths to an array
  try {
    paths = await fs.readdir(dir);
  } catch(err) {
    throw 'Failed to read directory ' + dir;
  }

  // loop through paths reading file contents
  for(const file of paths) {
    try {
      content = await fs.readFile(file, 'utf-8');
    } catch(err) {
      throw 'Failed to read contents of ' + file;
    }

    try {

    // another async function that manipulates content

    } catch(err)
      throw 'Failed to do whatever';
    }
  }
  return content;
}

// a function down here that calls read and handles thrown errors.

请一步一步地帮助我

2 个答案:

答案 0 :(得分:0)

您可以通过 -

检查用户是否已登录
 FirebaseAuth.getInstance().getCurrentUser()

如果用户未登录,则会返回null

答案 1 :(得分:0)

如果有启动画面,则在启动画面中检查FirebaseAuth.getInstance()。getCurrentUser()是否为null,然后相应地启动意图。

如果你没有使用启动画面,那么在onCreate()的启动活动中,检查一下。